﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Chapter01
{
    public class MainWindowViewModel
    {
        private List<Unit> catalogues;

        public MainWindowViewModel()
        {
            catalogues = new List<Unit>();
            catalogues.Add(new Unit { Num = 1, Title = "C# 与 .NET 的关系" });
            catalogues.Add(new Unit
            {
                Num = 2,
                Title = "公共语言运行库",
                ChildCatalogues = new List<Unit>
                {
                    new Unit { Num = 2.1, Title = "平台无关性" }, 
                    new Unit { Num = 2.2, Title = "提高性能" },
                    new Unit { Num = 2.3, Title = "语言的操作性" },
                }
            });
            catalogues.Add(new Unit
            {
                Num = 3,
                Title = "中间语言",
                ChildCatalogues = new List<Unit> 
                { 
                    new Unit { Num = 3.1, Title = "面向对象和接口的支持" }, 
                    new Unit { Num = 3.2, Title = "不同的值类型和引用类型" },
                    new Unit { Num = 3.3, Title = "强数据类型化" }, 
                    new Unit { Num = 3.4, Title = "通过异常处理错误" }, 
                    new Unit { Num = 3.5, Title = "特性的使用" },
                }
            });
            catalogues.Add(new Unit
            {
                Num = 4,
                Title = "程序集",
                ChildCatalogues = new List<Unit> 
                { 
                    new Unit { Num = 4.1, Title = "私有程序集" }, 
                    new Unit { Num = 4.2, Title = "共享程序集" },
                    new Unit { Num = 4.3, Title = "反射" }, 
                    new Unit { Num = 4.4, Title = "并行编程" }, 
                    new Unit { Num = 4.5, Title = "异步编程" },
                }
            });
            catalogues.Add(new Unit { Num = 5, Title = ".NET Framework 类" });
            catalogues.Add(new Unit { Num = 6, Title = "名称空间" });
            catalogues.Add(new Unit
            {
                Num = 7,
                Title = "用 C# 创建 .NET 应用程序",
                ChildCatalogues = new List<Unit> 
                { 
                    new Unit { Num = 7.1, Title = "创建 ASP.NET 应用程序" }, 
                    new Unit { Num = 7.2, Title = "使用 WPF" },
                    new Unit { Num = 7.3, Title = "Windows 8 应用程序" }, 
                    new Unit { Num = 7.4, Title = "Windows 服务" }, 
                    new Unit { Num = 7.5, Title = "WCF" },
                    new Unit { Num = 7.6, Title = "Window WF" },
                }
            });
            catalogues.Add(new Unit { Num = 8, Title = "C# 在 .NET 企业体系结构中的作用" });
            catalogues.Add(new Unit { Num = 9, Title = "小结" });
        }

        public List<Unit> Catalogues
        {
            get { return catalogues; }
        }

        public class Unit
        {
            public double Num { get; set; }
            public string Title { get; set; }
            public string Sample { get; set; }
            public List<Unit> ChildCatalogues { get; set; }
        }

        public override string ToString()
        {
            return "第01章 .NET 体系结构";
        }
    }
}
